const fp = require('lodash/fp')


class IO {
    constructor(fn) {
        this.value = fn
    }

    static of(value) {
        return new IO(function () {
            return value
        })
    }

    map(fn) {
        return new IO(fp.flowRight(fn, this.value))
    }
}

let r = IO.of(process)
    .map((p) => {
        return p.execPath
    })

console.log(r.value())
